import 'dart:convert';

enum TaskStatus { NotReceived, Receiving, AlreadyReceived }

// 任务类型 0或不传:获取用户积分 1签到 2新手任务 3日常任务 4进阶任务
enum TaskType { none, SignIn, NoviceTasks, DailyTasks, AdvancedTasks }

// 签到规则
class SignRuleType {
  // 天数
  int day;
  int integral;

  SignRuleType({required this.day, required this.integral});
}

class IntegralTabsItemDataType {
  String title;
  String describe;
  String icon;
  int score;
  String task_id;
  int task_code;
  //   0 // 任务状态 0-不可做(新手任务未完成) 1-待完成 2-已完成 3-已领取
  int status;

  IntegralTabsItemDataType(
      {this.title = '',
      this.icon = '',
      this.describe = '',
      this.score = 1,
      this.task_code = 1,
      this.task_id = '1',
      this.status = 0});

  Map<String, dynamic> toJson() {
    return {
      'title': title,
      'describe': describe,
      'icon': icon,
      'task_id': task_id,
      'score': score,
      'task_code': task_code,
      'status': status,
    };
  }

  @override
  String toString() {
    return jsonEncode(toJson());
  }
}

class IntegralTabsItemType {
  String name;
  TaskType value;
  bool isLoading;
  List<IntegralTabsItemDataType> data;

  IntegralTabsItemType(
      {this.value = TaskType.NoviceTasks,
      this.name = '',
      this.data = const [],
      this.isLoading = false});
}

class SignInItemType {
  int amount;
  bool isSignIn;
  bool isNormal;
  String date;

  SignInItemType(
      {this.amount = 1, this.isSignIn = false, this.isNormal = false,this.date=''});

  Map<String, dynamic> toJson() {
    return {
      'amount': amount,
      'isSignIn': isSignIn,
      'isNormal': isNormal,
      'date': date,
    };
  }

  @override
  String toString() {
    return jsonEncode(toJson());
  }
}

class SignInData {
  int days;
  String start;

  SignInData({
    this.days = 0,
    this.start = '',
  });

  Map<String, dynamic> toJson() {
    return {
      'start': start,
      'days': days,
    };
  }

  @override
  String toString() {
    return jsonEncode(toJson());
  }
}
